<html>
<head><meta charset="utf-8"><title>Resources required to build rustc · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html">Resources required to build rustc</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="156603903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156603903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156603903">(Jan 22 2019 at 13:36)</a>:</h4>
<p>Is there some estimate on how much memory and disk space one needs in order to build e.g. a stage1 rustc? The only reference I could <a href="https://github.com/rust-lang/rust/issues/56888" target="_blank" title="https://github.com/rust-lang/rust/issues/56888">find</a> only talks about 3GB being insufficient</p>



<a name="156603932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156603932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156603932">(Jan 22 2019 at 13:37)</a>:</h4>
<p>FWIW, I rustc OOM'd for me at <code>Killed process 1211 (rustc) total-vm:9055808kB, anon-rss:6715044kB, file-rss:0kB, shmem-rss:0kB</code> on an amd64 system</p>



<a name="156603954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156603954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156603954">(Jan 22 2019 at 13:38)</a>:</h4>
<p>I guess the reason I'm asking is in case I'm doing something wrong (e.g. not setting some option in <code>config.toml</code>)</p>



<a name="156604345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156604345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156604345">(Jan 22 2019 at 13:44)</a>:</h4>
<p>I’ve seen rustc build take upwards of 10GB with LTO enabled.</p>



<a name="156604468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156604468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156604468">(Jan 22 2019 at 13:46)</a>:</h4>
<p>@nagisa, thanks, that's very helpful. I'll try with thin-lto then</p>



<a name="156607904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156607904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156607904">(Jan 22 2019 at 14:29)</a>:</h4>
<p>OK, so I realized that the <code>thin-lto</code> option in <code>config.toml</code> applies to the llvm build. So I'm not really sure if there's anything else I can tweak?</p>



<a name="156608110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156608110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> QuietMisdreavus <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156608110">(Jan 22 2019 at 14:32)</a>:</h4>
<p>when i had problems building rustc on a low-spec server, i had some luck with turning down the number of codegen units and turning off debuginfo</p>



<a name="156608259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156608259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> QuietMisdreavus <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156608259">(Jan 22 2019 at 14:34)</a>:</h4>
<p>those should all be off by default tho, so i dunno what else to suggest :/</p>



<a name="156608320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156608320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156608320">(Jan 22 2019 at 14:35)</a>:</h4>
<p><span class="user-mention" data-user-id="133692">@QuietMisdreavus</span> well I have enabled debuginfo, but that's kind of a requirement, no? (I want to look at an ICE)</p>



<a name="156608358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156608358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> QuietMisdreavus <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156608358">(Jan 22 2019 at 14:35)</a>:</h4>
<p>yeah, without debuginfo that gets a lot harder</p>



<a name="156608756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156608756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156608756">(Jan 22 2019 at 14:39)</a>:</h4>
<p>debug info will definitely make your memory requirements for a build a dozen or so times larger.</p>



<a name="156608784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156608784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156608784">(Jan 22 2019 at 14:39)</a>:</h4>
<p>you may have some success by using the lld linker</p>



<a name="156609042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156609042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156609042">(Jan 22 2019 at 14:42)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I tried setting <code>target.x86_64-unknown-linux-gnu.linker</code> to lld, but then I got compilation errors in libc, as the build clearly expected a compiler interface there (<code>-Wl,</code>). switched to using <code>linker = clang</code> which I'm not sure that it uses lld on my distro</p>



<a name="156609080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156609080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156609080">(Jan 22 2019 at 14:43)</a>:</h4>
<p>You want <code>[rust.lld]</code>.</p>



<a name="156609097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156609097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156609097">(Jan 22 2019 at 14:43)</a>:</h4>
<p>(there should be a line commented out that says <code>lld = false</code> or something)</p>



<a name="156609172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156609172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156609172">(Jan 22 2019 at 14:44)</a>:</h4>
<p>ah, indeed, thanks</p>



<a name="156681160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156681160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156681160">(Jan 23 2019 at 11:19)</a>:</h4>
<p>OK, so, for anyone searching for this info in the future: with debuginfo and 'lld = true', peak RSS  was ~1.4GB and the resulting <code>build</code> directory is 11+GB</p>



<a name="156681170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156681170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156681170">(Jan 23 2019 at 11:19)</a>:</h4>
<p>that is for stage1 only (<code>./x.py build -i --stage 1 src/libstd</code>)</p>



<a name="156681176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156681176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156681176">(Jan 23 2019 at 11:19)</a>:</h4>
<p>Should maybe add this to the rustc guide somewhere</p>



<a name="156681240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Resources%20required%20to%20build%20rustc/near/156681240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ange <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Resources.20required.20to.20build.20rustc.html#156681240">(Jan 23 2019 at 11:20)</a>:</h4>
<p>I'll do a rebuild from scratch at some point to verify the numbers and then hopefully send a PR</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>